home *** CD-ROM | disk | FTP | other *** search
- Path: news.jhu.edu!news
- From: yuehong@psi.ece.jhu.edu (yuehong)
- Newsgroups: comp.lang.c++
- Subject: Re: Copy constructor
- Date: 12 Apr 1996 15:54:53 GMT
- Organization: The Johns Hopkins Univ.
- Message-ID: <4klucd$698@news.jhu.edu>
- References: <4kjudi$2qj0@holly.ACNS.ColoState.EDU>
- NNTP-Posting-Host: 128.220.62.157
- X-Newsreader: WinVN 0.92.6+
-
- In article <4kjudi$2qj0@holly.ACNS.ColoState.EDU>, corbyh@holly.ACNS.ColoState.EDU (Corby S. Hudnall) says:
- >
- >Hi all, I'm having some trouble figuring out how to do a copy
- >constructor. Here's what I thought was suppose to work:
- >
- >header file----
- >class ABC
- >{
- > private:
- > int AnInt;
- >
- > public:
- > ABC():AnInt(5) {} // Default Constructor
- > ~ABC() {} // Default Destructor
- > ABC(const ABC&); // Copy constructor
- >} <---you missed ";" here.
-
-
-
- >
- >ABC::ABC(const ABC& NewABC)
- >{
- > this->AnInt = NewABC->AnInt;<----- NewABC is not a pointer.
- >}
- >
-